#pragma once
#include <QGLWidget>
#include <QTabletEvent>

class Canvas : public QGLWidget {
    Q_OBJECT

    public:
        Canvas(QWidget *parent = 0);
        ~Canvas();

    protected:
        void initializeGL();
        void tabletEvent(QTabletEvent *event);
        void paintEvent(QPaintEvent *event);
        void resizeGL(int width, int height);

    private:
        void setupViewport(int width, int height);

        float x;
        float y;
        float tx;
        float ty;

        QPointF lastPos;

        QPointF rot;
        QPointF pos;
        QPointF zoom;

        QPointF startRot;
        QPointF startPos;
        QPointF startZoom;

        bool trackPos;
        bool trackRot;
        bool trackZoom;
};
